package oi;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class OOS {
    public static void main(String[] args) {
        String name = "大熊";
        String gender = "男";
        int age = 18;
        String[] other = {"学渣", "男神"};
        Person p = new Person(name, gender, age, other);


        try (ObjectOutputStream oos = new ObjectOutputStream(
                new FileOutputStream("oos.dat"))) {
            oos.writeObject(p);
        } catch (IOException e) {
            e.printStackTrace();
        }
        System.out.println("实例化成功");
    }
}
